package com.iplant.aps.service.po.oms;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;

import java.io.Serializable;
import java.util.Calendar;

/**
 * 订单
 *
 * @author PengYouWang
 * 2023-8-1 14:01:57
 */
@DBBasePO(TableName = "oms_order", CheckName = {"Code"}, Name = false, CodeAuto = true,
        CodePrefix = "OMSO-{yyyyMMdd}-", Schemas = DBSchemas.APS)
public class OMSOrder extends BasePO implements Serializable {

    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;

    /**
     * ERPID
     */
    @DBField
    public int ERPID = 0;


    /**
     * 工厂ID
     */
    @DBCondition
    @DBField
    public int FactoryID = 0;
    /**
     * 工厂名称
     */
    @DBJoin(name = "Name", tableName = "fmc_factory", tableAsName = "fmc_factory1", Schemas = DBSchemas.Basic,
            MainTableField = "FactoryID")
    public String FactoryName = "";
    /**
     * 工厂编码
     */
    @DBJoin(name = "Code", tableName = "fmc_factory", tableAsName = "fmc_factory1", Schemas = DBSchemas.Basic,
            MainTableField = "FactoryID")
    public String FactoryCode = "";

    /**
     * 修程ID
     */
    @DBCondition
    @DBField
    public int LineID = 0;
    /**
     * 修程
     */
    @DBJoin(name = "Name", tableName = "fmc_line", tableAsName = "fmc_line1", Schemas = DBSchemas.PDM,
            MainTableField = "LineID")
    public String LineName = "";
    @DBJoin(name = "Code", tableName = "fmc_line", tableAsName = "fmc_line1", Schemas = DBSchemas.PDM,
            MainTableField = "LineID")
    public String LineCode = "";
    /**
     * 产品类型ID
     */
    @DBCondition
    @DBField
    public int ProductID = 0;
    /**
     * 产品类型名称
     */
    @DBJoin(name = "Name", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductName = "";
    /**
     * 产品类型编码
     */
    @DBJoin(name = "Code", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductCode = "";

    /**
     * 产品类型编码
     */
    @DBJoin(name = "SimplifiedCode", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductSimplifiedCode = "";

    /**
     * 客户ID
     */
    @DBCondition
    @DBField
    public int CustomerID = 0;
    /**
     * 客户名称
     */
    @DBJoin(name = "Name", tableName = "crm_customer", tableAsName = "crm_customer1", Schemas = DBSchemas.Basic,
            MainTableField = "CustomerID")
    public String CustomerName = "";
    /**
     * 客户编码
     */
    @DBJoin(name = "Code", tableName = "crm_customer", tableAsName = "crm_customer1", Schemas = DBSchemas.Basic,
            MainTableField = "CustomerID")
    public String CustomerCode = "";

    /**
     * 工件号（广机：车号）
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String PartNo = "";
    /**
     * BOM编号
     */
    @DBField
    public String BOMNo = "";
    /**
     * 优先级
     */
    @DBField
    public int Priority = 0;
    /**
     * 订单状态
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.in)
    @DBField
    public int Status;
    /**
     * 计划进厂日期  计划开工日期
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.gtLe, ParamName = "PSTime", ParamName2 = "PETime")
    @DBField
    public Calendar PlanReceiveDate = Calendar.getInstance();
    /**
     * 实际进厂日期
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.gtLe, ParamName = "RSTime", ParamName2 = "RETime")
    @DBField
    public Calendar RealReceiveDate = Calendar.getInstance();
    /**
     * 预计完工日期
     */
    @DBField
    public Calendar PlanFinishDate = Calendar.getInstance();
    /**
     * 实际开工日期
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.gtLe, ParamName = "RelStartTime", ParamName2 = "RelEndTime")
    @DBField
    public Calendar RealStartDate = Calendar.getInstance();
    /**
     * 实际完工日期
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.gtLe, ParamName = "RelFStartTime", ParamName2 = "RelFEndTime")
    @DBField
    public Calendar RealFinishDate = Calendar.getInstance();
    /**
     * 发车日期 （交车日期）
     */
    @DBField
    public Calendar RealSendDate = Calendar.getInstance();

    /**
     * 工艺路线ID
     */
    @DBCondition
    @DBField
    public int RouteID = 0;

    /**
     * 工艺路线名称
     */
    @DBJoin(name = "Name", tableName = "fpc_route", tableAsName = "fpc_route1", Schemas = DBSchemas.PDM,
            MainTableField = "RouteID")
    public String RouteName = "";

    /**
     * 工艺路线版本
     */
    @DBJoin(name = "Version", tableName = "fpc_route", tableAsName = "fpc_route1", Schemas = DBSchemas.PDM,
            MainTableField = "RouteID")
    public String RouteVersion = "";

    /**
     * 订单就绪时刻（广机：电报时刻）
     */
    @DBField
    public Calendar TelegraphTime = Calendar.getInstance();
    /**
     * 电报到厂时刻
     */
    @DBField
    public Calendar TelegraphRealTime = Calendar.getInstance();

    /**
     * WBS编号
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String WBSNo = "";
    @DBField
    public int FQTYPlan;
    @DBField
    public int FQTYActual;

    /**
     * 停时
     */
    @DBField
    public int StopTime = 0;

    /**
     * 工艺集总数
     */
    @DBField
    public int StationTotalSize = 0;
    /**
     * 工艺完成数
     */
    @DBField
    public int StationFinishSize = 0;

    /**
     * 离段时间
     */
    @DBField
    public Calendar TimeAway = Calendar.getInstance();
    /**
     * 电报竣工时刻
     */
    @DBField
    public Calendar CompletionTelegramTime = Calendar.getInstance();
    /**
     * 接车司机到厂日期
     */
    @DBField
    public Calendar DriverOnTime = Calendar.getInstance();
    /**
     * 到段时间
     */
    @DBField
    public Calendar ToSegmentTime = Calendar.getInstance();
    /**
     * 实际检修停时
     */
    @DBField
    public int ActualRepairStopTimes = 0;
    /**
     * 电报检修停时
     */
    @DBField
    public int TelegraphRepairStopTimes = 0;
    /**
     * 在厂停时
     */
    @DBField
    public int InPlantStopTimes = 0;
    /**
     * 在途停时
     */
    @DBField
    public int OnTheWayStopTimes = 0;
    /**
     * 验后停时
     */
    @DBField
    public int PosterioriStopTimes = 0;

    /**
     * 订单类型
     */
    @DBCondition
    @DBField
    public int OrderType = 0;

    /**
     * 年度（广机特有，用于报表统计）
     */
    @DBCondition
    @DBField
    public int Year = 0;

    /**
     * 返修数（辅助属性）
     */
    public int ReworkNum = 0;

    /**
     * 抽检数（辅助属性）
     */
    public int SamplingNum = 0;

    public OMSOrder() {
        PlanReceiveDate.set(2000, 0, 1);
        RealReceiveDate.set(2000, 0, 1);
        PlanFinishDate.set(2000, 0, 1);
        RealStartDate.set(2000, 0, 1);
        RealFinishDate.set(2000, 0, 1);
        RealSendDate.set(2000, 0, 1);
        CreateTime.set(2000, 0, 1);
        EditTime.set(2000, 0, 1);
        TelegraphTime.set(2000, 0, 1);
        TelegraphRealTime.set(2000, 0, 1);
        TimeAway.set(2000, 0, 1);
        CompletionTelegramTime.set(2000, 0, 1);
        DriverOnTime.set(2000, 0, 1);
        ToSegmentTime.set(2000, 0, 1);
    }

    @JsonProperty("ERPID")
    public int getERPID() {
        return ERPID;
    }

    public void setERPID(int ERPID) {
        this.ERPID = ERPID;
    }


    @JsonProperty("LineID")
    public int getLineID() {
        return LineID;
    }

    public void setLineID(int lineID) {
        LineID = lineID;
    }

    @JsonProperty("LineName")
    public String getLineName() {
        return LineName;
    }

    public void setLineName(String lineName) {
        LineName = lineName;
    }

    @JsonProperty("LineCode")
    public String getLineCode() {
        return LineCode;
    }

    public void setLineCode(String lineCode) {
        LineCode = lineCode;
    }

    @JsonProperty("ProductID")
    public int getProductID() {
        return ProductID;
    }

    public void setProductID(int productID) {
        ProductID = productID;
    }

    @JsonProperty("ProductName")
    public String getProductName() {
        return ProductName;
    }

    public void setProductName(String productName) {
        ProductName = productName;
    }

    @JsonProperty("ProductCode")
    public String getProductCode() {
        return ProductCode;
    }

    public void setProductCode(String productCode) {
        ProductCode = productCode;
    }

    @JsonProperty("CustomerID")
    public int getCustomerID() {
        return CustomerID;
    }

    public void setCustomerID(int customerID) {
        CustomerID = customerID;
    }

    @JsonProperty("CustomerName")
    public String getCustomerName() {
        return CustomerName;
    }

    public void setCustomerName(String customerName) {
        CustomerName = customerName;
    }

    @JsonProperty("CustomerCode")
    public String getCustomerCode() {
        return CustomerCode;
    }

    public void setCustomerCode(String customerCode) {
        CustomerCode = customerCode;
    }

    @JsonProperty("PartNo")
    public String getPartNo() {
        return PartNo;
    }

    public void setPartNo(String partNo) {
        PartNo = partNo;
    }

    @JsonProperty("BOMNo")
    public String getBOMNo() {
        return BOMNo;
    }

    public void setBOMNo(String BOMNo) {
        this.BOMNo = BOMNo;
    }

    @JsonProperty("Priority")
    public int getPriority() {
        return Priority;
    }

    public void setPriority(int priority) {
        Priority = priority;
    }

    @JsonProperty("Status")
    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        Status = status;
    }

    @JsonProperty("PlanReceiveDate")
    public Calendar getPlanReceiveDate() {
        return PlanReceiveDate;
    }

    public void setPlanReceiveDate(Calendar planReceiveDate) {
        PlanReceiveDate = planReceiveDate;
    }

    @JsonProperty("RealReceiveDate")
    public Calendar getRealReceiveDate() {
        return RealReceiveDate;
    }

    public void setRealReceiveDate(Calendar realReceiveDate) {
        RealReceiveDate = realReceiveDate;
    }

    @JsonProperty("PlanFinishDate")
    public Calendar getPlanFinishDate() {
        return PlanFinishDate;
    }

    public void setPlanFinishDate(Calendar planFinishDate) {
        PlanFinishDate = planFinishDate;
    }

    @JsonProperty("RealStartDate")
    public Calendar getRealStartDate() {
        return RealStartDate;
    }

    public void setRealStartDate(Calendar realStartDate) {
        RealStartDate = realStartDate;
    }

    @JsonProperty("RealFinishDate")
    public Calendar getRealFinishDate() {
        return RealFinishDate;
    }

    public void setRealFinishDate(Calendar realFinishDate) {
        RealFinishDate = realFinishDate;
    }

    @JsonProperty("RealSendDate")
    public Calendar getRealSendDate() {
        return RealSendDate;
    }

    public void setRealSendDate(Calendar realSendDate) {
        RealSendDate = realSendDate;
    }

    @JsonProperty("RouteID")
    public int getRouteID() {
        return RouteID;
    }

    public void setRouteID(int routeID) {
        RouteID = routeID;
    }

    @JsonProperty("TelegraphTime")
    public Calendar getTelegraphTime() {
        return TelegraphTime;
    }

    public void setTelegraphTime(Calendar telegraphTime) {
        TelegraphTime = telegraphTime;
    }

    @JsonProperty("TelegraphRealTime")
    public Calendar getTelegraphRealTime() {
        return TelegraphRealTime;
    }

    public void setTelegraphRealTime(Calendar telegraphRealTime) {
        TelegraphRealTime = telegraphRealTime;
    }

    @JsonProperty("WBSNo")
    public String getWBSNo() {
        return WBSNo;
    }

    public void setWBSNo(String WBSNo) {
        this.WBSNo = WBSNo;
    }

    @JsonProperty("FactoryID")
    public int getFactoryID() {
        return FactoryID;
    }

    public void setFactoryID(int factoryID) {
        FactoryID = factoryID;
    }

    @JsonProperty("FactoryName")
    public String getFactoryName() {
        return FactoryName;
    }

    public void setFactoryName(String factoryName) {
        FactoryName = factoryName;
    }

    @JsonProperty("FactoryCode")
    public String getFactoryCode() {
        return FactoryCode;
    }

    public void setFactoryCode(String factoryCode) {
        FactoryCode = factoryCode;
    }

    @JsonProperty("FQTYPlan")
    public int getFQTYPlan() {
        return FQTYPlan;
    }

    public void setFQTYPlan(int FQTYPlan) {
        this.FQTYPlan = FQTYPlan;
    }

    @JsonProperty("FQTYActual")
    public int getFQTYActual() {
        return FQTYActual;
    }

    public void setFQTYActual(int FQTYActual) {
        this.FQTYActual = FQTYActual;
    }

    @JsonProperty("StopTime")
    public int getStopTime() {
        return StopTime;
    }

    public void setStopTime(int stopTime) {
        StopTime = stopTime;
    }

    @JsonProperty("StationTotalSize")
    public int getStationTotalSize() {
        return StationTotalSize;
    }

    public void setStationTotalSize(int stationTotalSize) {
        StationTotalSize = stationTotalSize;
    }

    @JsonProperty("StationFinishSize")
    public int getStationFinishSize() {
        return StationFinishSize;
    }

    public void setStationFinishSize(int stationFinishSize) {
        StationFinishSize = stationFinishSize;
    }

    @JsonProperty("TimeAway")
    public Calendar getTimeAway() {
        return TimeAway;
    }

    public void setTimeAway(Calendar timeAway) {
        TimeAway = timeAway;
    }

    @JsonProperty("CompletionTelegramTime")
    public Calendar getCompletionTelegramTime() {
        return CompletionTelegramTime;
    }

    public void setCompletionTelegramTime(Calendar completionTelegramTime) {
        CompletionTelegramTime = completionTelegramTime;
    }

    @JsonProperty("DriverOnTime")
    public Calendar getDriverOnTime() {
        return DriverOnTime;
    }

    public void setDriverOnTime(Calendar driverOnTime) {
        DriverOnTime = driverOnTime;
    }

    @JsonProperty("ToSegmentTime")
    public Calendar getToSegmentTime() {
        return ToSegmentTime;
    }

    public void setToSegmentTime(Calendar toSegmentTime) {
        ToSegmentTime = toSegmentTime;
    }

    @JsonProperty("ActualRepairStopTimes")
    public int getActualRepairStopTimes() {
        return ActualRepairStopTimes;
    }

    public void setActualRepairStopTimes(int actualRepairStopTimes) {
        ActualRepairStopTimes = actualRepairStopTimes;
    }

    @JsonProperty("TelegraphRepairStopTimes")
    public int getTelegraphRepairStopTimes() {
        return TelegraphRepairStopTimes;
    }

    public void setTelegraphRepairStopTimes(int telegraphRepairStopTimes) {
        TelegraphRepairStopTimes = telegraphRepairStopTimes;
    }

    @JsonProperty("InPlantStopTimes")
    public int getInPlantStopTimes() {
        return InPlantStopTimes;
    }

    public void setInPlantStopTimes(int inPlantStopTimes) {
        InPlantStopTimes = inPlantStopTimes;
    }

    @JsonProperty("OnTheWayStopTimes")
    public int getOnTheWayStopTimes() {
        return OnTheWayStopTimes;
    }

    public void setOnTheWayStopTimes(int onTheWayStopTimes) {
        OnTheWayStopTimes = onTheWayStopTimes;
    }

    @JsonProperty("PosterioriStopTimes")
    public int getPosterioriStopTimes() {
        return PosterioriStopTimes;
    }

    public void setPosterioriStopTimes(int posterioriStopTimes) {
        PosterioriStopTimes = posterioriStopTimes;
    }

    @JsonProperty("OrderType")
    public int getOrderType() {
        return OrderType;
    }

    public void setOrderType(int orderType) {
        OrderType = orderType;
    }

    @JsonProperty("Year")
    public int getYear() {
        return Year;
    }

    public void setYear(int year) {
        Year = year;
    }

    @JsonProperty("ProductSimplifiedCode")
    public String getProductSimplifiedCode() {
        return ProductSimplifiedCode;
    }

    public void setProductSimplifiedCode(String productSimplifiedCode) {
        ProductSimplifiedCode = productSimplifiedCode;
    }

    @JsonProperty("RouteName")
    public String getRouteName() {
        return RouteName;
    }

    public void setRouteName(String routeName) {
        RouteName = routeName;
    }

    @JsonProperty("RouteVersion")
    public String getRouteVersion() {
        return RouteVersion;
    }

    public void setRouteVersion(String routeVersion) {
        RouteVersion = routeVersion;
    }

    @JsonProperty("ReworkNum")
    public int getReworkNum() {
        return ReworkNum;
    }

    public void setReworkNum(int reworkNum) {
        ReworkNum = reworkNum;
    }

    @JsonProperty("SamplingNum")
    public int getSamplingNum() {
        return SamplingNum;
    }

    public void setSamplingNum(int samplingNum) {
        SamplingNum = samplingNum;
    }
}
